algorithm for finding greatest among three numbers